const Koa=require('koa')

const app=new Koa();
const connect=require('./db/index')
const {query}=require('./db/index')
const router=require('koa-router')()



router.get('/list',async ctx=>
{
    let res=await new Promise((resolve,reject)=>{
        connect.query(`select * from login`,(err,data)=>
        {
            if(!err)
            {
                resolve(data)
            }
            else
            {
                console.log("失败");
            }
        })
    })
    
    ctx.body={
        code:0,
        mes:"list"
    }
    console.log(ctx.body);
})
app.use(router.routes());
app.listen(3000)